Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to get a iCalendar format feed from any calendar #349

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

randohinn
Copy link

@randohinn randohinn commented Feb 13, 2022

This PR adds the ability to add ?ics=true to the end of any calendar URL and get an iCalendar formatted feed generated and returned back. This is useful as the plugin can provide this link to both single and grouped calendars, making mass-sharing of grouped calendars much easier.

Welcome to feedback and/or changes needed to better structure this. So far, I have tested this on the site of JCI Estonia with a grouped calendar of 11 individual calendars and over 100 events successfully.

Copy link
Member

@rosinghal rosinghal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@randohinn let me start by apologising for the delay in checking. Thanks so much for submitting this PR.

if(strpos($ics, $event->uid) == false) {
$ics .= "BEGIN:VEVENT\r\n";
$ics .="UID:" . $event->uid . "\r\n";
$ics .="DTSTAMP:" . $event->start_dt->format('Ymd\THis') . "\r\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the timings are not matching, maybe because of timezone

Screenshot 2023-03-20 at 8 37 03 AM

(purple is ICS export and yellow is Google calendar)

$ics .= "DTSTART:" . $event->start_dt->format('Ymd\THis') . "\r\n";
$ics .= "DTEND:" . $event->end_dt->format('Ymd\THis') . "\r\n";
$ics.= "SUMMARY:" . format_ical_string($event->title) . "\r\n";
$ics .= "DESCRIPTION:" . format_ical_string($event->description) . "\r\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would nice to check if the description is present, if not we can skip adding the description.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for LOCATION and GEO.

@@ -287,11 +342,11 @@ function simcal_default_event_template() {

$content = '<strong>' . '[title]' . '</strong>';
$content .= "\n\n";
$content .= '[when]' . "\n";
$content .= '[when]' . "\r\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these changes for?

@@ -180,6 +180,13 @@ public function load_admin() {
}
}

public function simcal_ics_action() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the formatting, a tab is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants